import Vue from 'vue'
import App from './App.vue'
import typeNav from "@/components/typeNav/typeNav.vue"
import swipers from "@/components/swipers/swiper.vue"
import pagination from "@/components/pagination/pagination.vue"

// 测试自定义插件刨根Vue.use()原理
import Plugins from '@/plugins/myTestPlugins.js'
// use时自动调用install方法内的东西
// Vue.use(Plugins, {
//   name: 'upper'
// })
// 注册全局组件
Vue.component(typeNav.name, typeNav)
Vue.component(swipers.name, swipers)
Vue.component(pagination.name, pagination)

// 导入 vuex
import store from "@/store/store.js"

// 导入路由
import router from '@/router/router.js'

// 引入mock插件
import '@/mockjs/mockServe.js'

// 引入 swiper css
import 'swiper/css/swiper.css'
import 'swiper/js/swiper.min.js'

// 引入 icon图标
import '../src/icons/font_2359481_q4cu03hnwyd/iconfont.css';

// 引入所有的api,不使用vuex
import * as Api from '@/axios/api/api.js'

import loadimage from '@/assets/IMG_20180625_191337.jpg'
// 引入图片懒加载插件
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading: loadimage,
  attempt: 1
})

// 校验工具validate(直接引入就行不需要暴露,只需要执行里面的代码)
import '@/utils/validate/vee-validate.js'
// 导入element ui
import '@/plugins/elementui.js'


new Vue({
  render: h => h(App),
  // 全局事件总线 $bus 配置
  beforeCreate() {
    // this === 大写的VM
    Vue.prototype.$bus = this
    Vue.prototype.$Api = Api
  },
  // 挂载
  router,
  store
}).$mount('#app')
